Copyright 1992 Primatech Inc. All rights reserved. 24 August 1992 I have made a few changes to the code in this archive. The only externally visible change is the addition of the "retChar" field to TEditor. This enables you to set the display character that represents a hard return. The other changes were mostly small changes made over the past few months to correct problems or enhance performance. Many of them should be documented in affected modules. These modules have been synchronized with the version of TurboVision that was released with Borland C++ & AF 3.1 (1.03). It has been tested, but not extensively. As before, I do not promise anything, and cannot provide much support, but comments are welcomed. Copyright 1992 Primatech Inc. All rights reserved. 3 January 1992 This package includes the modules necessary to implement a word wrapping editor in Borland's TurboVision for C++. Although I wanted to derive this class from the existing TEditor class, after some research, I determined that the TEditor class was not flexible enough to support this. Because of this, the approach that we took was to actually modify and add to the existing TEditor code that was provided by Borland. Because we wanted to provide compatibility with the existing code, and we did not want to duplicate all of the existing functions, the new wordwrapping editor is still called TEditor. The new features are activated by setting the new Boolean field "wordWrap" to True. Other new fields (documented later) control other features. In its default configuration, the TEditor class should be compatible with the version provided by Borland. This implementation was designed and coded by Jeff Hottle and John Swartzentruber of Primatech Inc. This code has been tested enough for the major bugs to become apparent. It is quite possible that other bugs or problems remain in the code. We make no promises about the stability or suitability of this code. Any use of these modules is at your own risk. These changes were developed with the TurboVision that was distributed with BC++ 2.0. I have since incorporated some of the (minor) changes made in the version distributed with BC++ 3.0. I compiled and ran a small program and it seemed to work. None of these modules is placed in the public domain. All original TurboVision modules are still Copyright 1991 by Borland International. The new modules that we have provided are Copyright 1991 by Primatech Inc. All rights reserved. You have the permission of Primatech Inc. to use these modules as you wish. You may not, however, distribute the source code unless this file is included and no modifications have been made to any of the source code modules. Any restrictions that Borland has placed on the use and distribution of TurboVision modules still apply to those modules. USING THESE CHANGES: ------------------- Because of the changes made to TV header files, the entire library must be rebuilt. I have also included modified modules from the TVEdit demo program that can be used to demonstrate these changes. They are real Q&D, so don't use them as a good example. Before you rebuild the library, make sure that you rebuild the GENINC program and use it to create TVWRITE.INC. I believe the standard batch files will do this. You will need to remove the stack checking code in TView.cpp. It is only used during development to determine where the highest stack usage is. DOCUMENTATION: ------------- As will soon become apparent, there is no documentation. Although we would both like it to be fully documented, you would probably never get it if we waited that long. I will attempt to answer answer your questions if it doesn't get too time consuming. I would also appreciate any bug reports, but I can't promise that I will be able to provide immediate responses. Additional TEditor Fields: ------------------------- Boolean wordWrap If set to True, wordwrapping will take place. If set to False, TEditor should act like the original version. ushort rMargin This is the right margin. If word wrapping is turned on, this is where the text will wrap. Boolean autosizeMargin If this is set to True, the rMargin value will automatically change when the size of the TEditor view changes. uchar tabSize The space between tab stops. Although not part of wordwrapping, an important enhancement to the original (which had 8 hardcoded). char retChar The display character used to represent a hard return. The default is a space. OTHER CHANGES: ------------- Notice that some of the TEditor member function declarations have been changed to add some new fields. Also notice that some functions have been put inline or made const. The shiftstate was added to TEvent. This is not yet used everywhere, but a number of uses of the BIOS data area have been changed to use the shiftstate in the event. I made this change so that the shiftstate is bound with the key that causes the event. This is important when implementing an event recording feature for keyboard macros. TECHNICAL APPROACH: ------------------ There are a number of ways that word wrapping can be implemented. Because we were interested in keeping as much of the existing code as possible, we decided to insert end of line codes into the text buffer. The code that we chose was a single carriage return (CR) character (character 13). We call it a soft return. User entered end of line codes are referred to as hard returns. A hard return is made up of a carriage return followed by a line feed ("\r\n" or "\x0D\x0A"). John L. Swartzentruber CIS:76646,1430 Jeff A. Hottle Primatech Inc. 445 Hutchinson Ave, Suite 200 Columbus, Ohio 43235 FAX: (614) 841-9805